<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>02-单元素/组件的入场和出场 过渡和动画</title>
    <style>
        @keyframes move {
            0%{
                transform: translateX(-100px);
            }

            50%{
                transform: translateX(-50px);
            }

            75%{
                transform: translateX(50px);
            }

            100%{
                transform: translateX(0);
            }
        }

      /*.v-enter-from{
          opacity: 0;
      }*/

      .yunmu-enter-active,
      .yunmu-leave-active{
          /*transition: opacity 2s ease;*/
          animation: move 2s ease-in;
      }

      /*.v-enter-to{
          opacity: 1;
      }*/

    

      /*.v-leave-to{
          opacity: 0;
      }*/
    </style>
  </head>
  <body>
    <script src="https://unpkg.com/vue@next"></script>
    <div id="root"></div>

    <script>
      
      const app = Vue.createApp({
        data() {
          return {
            show:false
          };
        },

        methods: {
          handleClick() {
              this.show = !this.show;
          }
            
        },


        template: `
                <transition name="yunmu">
                   <div v-if="show">hello world</div>
                </transition> 
                   <button @click="handleClick">切换</button>  
                `,
      });

      const vm = app.mount("#root");
    </script>
  </body>
</html>
